import request from '@/utils/request'


// 登录方法
export function login(userName, password) {
	let data = {"username":userName,"password":password}
	return request({
		url: '/login',
		headers: {
			isToken: false
		},
		method: 'post',
		data: data
	})
}


// 用户密码重置
export function updateUserPwd(oldPassword, newPassword) {
  const data = {
    "oldPassword":oldPassword,
    "newPassword":newPassword
  }
  return request({
    url: '/system/user/profile/updatePwd',
    method: 'get',
    params: data
  })
}


// 用户密码修改
export function updateAppUserPwd(oldPassword, newPassword) {
  const data = {
    "oldPassword":oldPassword,
    "newPassword":newPassword
  }
  return request({
    url: '/service/register/app/updatePwd',
    method: 'get',
    params: data
  })
}




// 注册
export function appAdd(data) {
  return request({
    url: '/service/register/appAdd',
    method: 'post',
    data: data
  })
}



// 获取用户详细信息
export function getInfo() {
	return request({
		url: '/getInfo',
		method: 'get'
	})
}



export function getUserInfoByPhone(query) {
	return request({
		url: '/service/register/phone',
		method: 'get',
		params: query
	})
}


//获取当前登录的用户信息
export function appLoginUser() {
	return request({
		url: '/service/register/app/loginUser',
		method: 'get'
	})
}

//获取当前登录的用户信息
export function appUpdateInfo(data) {
	return request({
	  url: '/service/register/updateInfo',
	  method: 'put',
	  params: data
	})
}


//判断是不是管理员
export function judgeAdmin() {
	return request({
		url: '/service/register/app/admin',
		method: 'get'
	})
}







// 退出方法
export function logout() {
	return request({
		url: '/logout',
		method: 'post'
	})
}